<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="page"  uri="http://www.aptech.com/pager"%>
<!DOCTYPE html>
<html>
<head>
<!--
		Charisma v1.0.0

		Copyright 2012 Muhammad Usman
		Licensed under the Apache License v2.0
		http://www.apache.org/licenses/LICENSE-2.0

		http://usman.it
		http://twitter.com/halalit_usman
	-->
<meta charset="utf-8">
	<title>后台管理系统</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description"
	content="Charisma, a fully featured, responsive, HTML5, Bootstrap admin template.">
<meta name="author" content="Muhammad Usman">

<!-- The styles -->
<link id="bs-css" href="css/bootstrap-cerulean.css" rel="stylesheet">
<script src="js/jquery-1.7.2.min.js"></script>
<style type="text/css">
body {
	padding-bottom: 40px;
}

.sidebar-nav {
	padding: 9px 0;
}
#download{
 text-align:right;
 float:right;
}
</style>
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<link href="css/charisma-app.css" rel="stylesheet">
<link href="css/jquery-ui-1.8.21.custom.css" rel="stylesheet">
<link href='css/fullcalendar.css' rel='stylesheet'>
<link href='css/fullcalendar.print.css' rel='stylesheet' media='print'>
<link href='css/chosen.css' rel='stylesheet'>
<link href='css/uniform.default.css' rel='stylesheet'>
<link href='css/colorbox.css' rel='stylesheet'>
<link href='css/jquery.cleditor.css' rel='stylesheet'>
<link href='css/jquery.noty.css' rel='stylesheet'>
<link href='css/noty_theme_default.css' rel='stylesheet'>
<link href='css/elfinder.min.css' rel='stylesheet'>
<link href='css/elfinder.theme.css' rel='stylesheet'>
<link href='css/jquery.iphone.toggle.css' rel='stylesheet'>
<link href='css/opa-icons.css' rel='stylesheet'>
<link href='css/uploadify.css' rel='stylesheet'>

<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
	  <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->

<!-- The fav icon -->
<link rel="shortcut icon" href="img/favicon.ico">

</head>

<body>
	<s:include value="header.jsp" />
	<!-- topbar ends -->
	<div class="container-fluid">
		<div class="row-fluid">

			<s:include value="left.jsp" />

			<div id="content" class="span10">
				<!-- content starts -->
				<div>
					<ul class="breadcrumb">
						<li><a href="index">主页</a> <span class="divider">/</span></li>
						<li><a href="#">剩余包裹列表</a></li>
						<li id="download"><a href="getUntakenParcel!getExcel" class="download" >导出表格</a></li>
					</ul>
				</div>
				<div class="row-fluid sortable ui-sortable">
					<div class="box span12" style="margin-bottom: 30px;margin-top:0px;">
						<div class="box-header well" data-original-title="">
							<h4><i class="icon-edit"></i>剩余包裹列表</h4>
						</div>
						<div class="box-content">
						<div class=" row-fluid packagepages" >
								<table
									class="table table-striped table-bordered bootstrap-datatable dataTable" id="dateTable">
									<thead>
										<tr role="row">
											<th class="sorting_asc" role="columnheader" tabindex="0"
												aria-controls="DataTables_Table_0" rowspan="1" colspan="1">序号</th>
											<th class="sorting_asc" role="columnheader" tabindex="0"
												aria-controls="DataTables_Table_0" rowspan="1" colspan="1">网点设备</th>
											<th class="sorting" role="columnheader" tabindex="0"
												aria-controls="DataTables_Table_0" rowspan="1" colspan="1">柜号</th>
											<th class="sorting" role="columnheader" tabindex="0"
												aria-controls="DataTables_Table_0" rowspan="1" colspan="1">用户手机</th>
											<th class="sorting" role="columnheader" tabindex="0"
												aria-controls="DataTables_Table_0" rowspan="1" colspan="1">快递单号</th>
											<th class="sorting" role="columnheader" tabindex="0"
												aria-controls="DataTables_Table_0" rowspan="1" colspan="1">存入时间</th>
											<th class="sorting" role="columnheader" tabindex="0"
												aria-controls="DataTables_Table_0" rowspan="1" colspan="1">滞留天数</th>
											<th class="sorting" role="columnheader" tabindex="0"
												aria-controls="DataTables_Table_0" rowspan="1" colspan="1">验证码</th>
											<th class="sorting" role="columnheader" tabindex="0"
												aria-controls="DataTables_Table_0" rowspan="1" colspan="1">短信情况</th>
											<th class="sorting" role="columnheader" tabindex="0"
												aria-controls="DataTables_Table_0" rowspan="1" colspan="1">状态</th>
											<th class="sorting" role="columnheader" tabindex="0"
												aria-controls="DataTables_Table_0" rowspan="1" colspan="1">操作</th>
										</tr>
									</thead>
			
									<tbody>
											<s:if test="unTakenParcel.list.size()==0">
									    	<tr class="odd">
											  <td colspan="11">=_=没有找到任何记录。。。。。。。。</td>
											</tr>
									       </s:if>
										<s:iterator value="unTakenParcel.list" var="package" status="st">
											<tr class="odd">
												<td><s:property value="#st.index+1" /></td>
												<td><s:property value="#package.terminal.branch.branchName" /><s:property value="#package.terminal.name" /></td>
												<td class="center "><s:property value="#package.boxId" /></td>
												<td class="center "><s:property value="#package.userPhone" /></td>
												<td class="center "><s:property value="#package.parcelId" /></td>
												<td class="center"><s:date name="#package.storeTime" format="yyyy-MM-dd HH:mm:ss"/></td>
												<td class="center"><s:property value="#package.leftTime" /></td>
												<td class="center"><s:property value="#package.checkCode" /></td>
												<td class="center">
												<s:if test="#package.msgStatus==-1">发送失败</s:if>
												<s:elseif test="#package.msgStatus==1">发送成功</s:elseif>
												<s:else>未知</s:else>
												</td>
												<td class="center">
												<s:if test="#package.packageStatus==0">未取</s:if>
												<s:elseif test="#package.packageStatus==2">锁定</s:elseif>
												<s:elseif test="#package.packageStatus==4">退件</s:elseif>
												<s:else>=_=</s:else>
												</td>
												<td class="center">
												<a href="getPackageCourier?courierID=<s:property value="#package.courier.courierId" />">
													存件人详情
												</a>|
												<a href="smsStatus!getByParcelID?parcelID=<s:property value="#package.packageId" />">
													短信发送详情
												</a>|
												<a href="package!getLogParcel?packageID=<s:property value="#package.packageId" />">
													包裹操作详情
												</a>
												<s:if test="packageStatus!=5">
													|<a id="sign" href="javascript:void(0)" packageID="<s:property value="#package.packageId" />">标记</a>
												</s:if>
												<s:if test="packageStatus==2">
													|<a id="unLock" href="javascript:void(0)" packageID="<s:property value="#package.packageId" />">解锁</a>
												</s:if>
												</td>
											</tr>
										</s:iterator>
									</tbody>
								</table>
								<input type="hidden" value="${unTakenParcel.curpage}" id="curpage"/><input type="hidden" value="${unTakenParcel.pageSize }" id="pageSize"/>
							</div>
						</div>
					</div>
				</div>
				<!-- content ends -->
			</div>
			<!--/#content.span10-->
		</div>
		<!--/fluid-row-->

		<hr>

	<s:include value="footer.jsp" />

	</div>
	<!--/.fluid-container-->

	<!-- external javascript
	================================================== -->
	<!-- Placed at the end of the document so the pages load faster -->

	<!-- jQuery -->
	<%-- <script src="js/jquery-1.7.2.min.js"></script> --%>
	<!-- jQuery UI -->
	<script src="js/jquery-ui-1.8.21.custom.min.js"></script>
	<!-- transition / effect library -->
	<script src="js/bootstrap-transition.js"></script>
	<!-- alert enhancer library -->
	<script src="js/bootstrap-alert.js"></script>
	<!-- modal / dialog library -->
	<script src="js/bootstrap-modal.js"></script>
	<!-- custom dropdown library -->
	<script src="js/bootstrap-dropdown.js"></script>
	<!-- scrolspy library -->
	<script src="js/bootstrap-scrollspy.js"></script>
	<!-- library for creating tabs -->
	<script src="js/bootstrap-tab.js"></script>
	<!-- library for advanced tooltip -->
	<script src="js/bootstrap-tooltip.js"></script>
	<!-- popover effect library -->
	<script src="js/bootstrap-popover.js"></script>
	<!-- button enhancer library -->
	<script src="js/bootstrap-button.js"></script>
	<!-- accordion library (optional, not used in demo) -->
	<script src="js/bootstrap-collapse.js"></script>
	<!-- carousel slideshow library (optional, not used in demo) -->
	<script src="js/bootstrap-carousel.js"></script>
	<!-- autocomplete library -->
	<script src="js/bootstrap-typeahead.js"></script>
	<!-- tour library -->
	<script src="js/bootstrap-tour.js"></script>
	<!-- library for cookie management -->
	<script src="js/jquery.cookie.js"></script>
	<!-- calander plugin -->
	<script src='js/fullcalendar.min.js'></script>
	<!-- data table plugin -->
	<script src='js/jquery.dataTables.min.js'></script>

	<!-- chart libraries start -->
	<script src="js/excanvas.js"></script>
	<script src="js/jquery.flot.min.js"></script>
	<script src="js/jquery.flot.pie.min.js"></script>
	<script src="js/jquery.flot.stack.js"></script>
	<script src="js/jquery.flot.resize.min.js"></script>
	<!-- chart libraries end -->

	<!-- select or dropdown enhancer -->
	<script src="js/jquery.chosen.min.js"></script>
	<!-- checkbox, radio, and file input styler -->
	<script src="js/jquery.uniform.min.js"></script>
	<!-- plugin for gallery image view -->
	<script src="js/jquery.colorbox.min.js"></script>
	<!-- rich text editor library -->
	<script src="js/jquery.cleditor.min.js"></script>
	<!-- notification plugin -->
	<script src="js/jquery.noty.js"></script>
	<!-- file manager library -->
	<script src="js/jquery.elfinder.min.js"></script>
	<!-- star rating plugin -->
	<script src="js/jquery.raty.min.js"></script>
	<!-- for iOS style toggle switch -->
	<script src="js/jquery.iphone.toggle.js"></script>
	<!-- autogrowing textarea plugin -->
	<script src="js/jquery.autogrow-textarea.js"></script>
	<!-- multiple file upload plugin -->
	<script src="js/jquery.uploadify-3.1.min.js"></script>
	<!-- history.js for cross-browser state change on ajax -->
	<script src="js/jquery.history.js"></script>
	<!-- application script for Charisma demo -->
	<script src="js/charisma.js"></script>
	<script src="js/layer/layer.js"></script>
	<script language="javascript">
		$(".status").live("change",function(){
			//console.log("status============"+$(this).val());
			$.post("package!editPackage?status="+$(this).val()+"&packageID="+$(this).parent().parent().attr("packageID"),function(){
				funtips("标记成功！！！！！");
			});
		});
		$("#unLock").live("click",function(){
			//console.log("status============"+$(this).val());
			$.post("boxPackage!unLockParcel?packageID="+$(this).attr("packageID"),function(){
				funtips("解锁成功！！！！！");
				parent.location.reload();
			});
		});
		$("#sign").live("click",function(){
		     $.layer({
	        	  title:'标记包裹信息',
	              type : 2,
	              moveOut : false,
	              shade : [0.3 , '#000' , true],
	              border : [10 , 0.3 , '#000', true],
	              offset : ['30%', '30%'],
	              iframe : {
	                  src : "boxPackage!returnJSP?flag=sign&packageID=" + $(this).attr("packageID")
	              },	
	              area : ['650px','400px']
	          });
 	  	 });
		function funtips(str){
		    //提示框
			    var i =$.layer({
				shade : [0.3 , '#000' , true],
			    area : ['240px','130px'],
			    dialog : {
			        msg:str,
			        btns : 0, 
			        type : 1
			     }
			     });
			     setTimeout(function(){layer.close(i);},1000);
		}
		//回调函数，标记包裹
		function   sign(newPhone,problemID,reason,operate,detained,comment,packageID){
			var str = "&newPhone="+newPhone+"&problemID="+problemID+"&reason="+reason+"&operate="+operate+"&detained="+detained+"&comment="+comment+"&packageID="+packageID;
			//console.log("url============"+str);
			$.post("boxPackage!signParcel?flag=sign"+str,function(v){
				if(operate==1||operate==2){
					funtips("标记成功，请返回上级页面！");
				}else{
			     funtips("标记成功！！！！！");
			     parent.location.reload();
				}
			});
	     }
	</script>

</body>
</html>
